package com.company.observe;

import java.util.ArrayList;
import java.util.List;

public class MySubject implements SubjectUpdate {
    List<Observer> list = new ArrayList<Observer>();

    @Override
    public void update() {
        for (Observer item : list) {
            item.run();
        }
    }

    @Override
    public void register(Observer observer) {
        list.add(observer);
    }

    @Override
    public void unregister(Observer observer) {
        list.remove(observer);
    }

}
